package megrez.common.spring.data;

import java.io.Serializable;

import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
 * 基础视图化实体
 *  
 * @author Lucky Yang
 * @since 0.0.1
 */
@ToString
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
public abstract class AbstractBaseVO<I extends Serializable, V extends Serializable> implements Persistable<I>, Versionable<V>, Serializable {
    @EqualsAndHashCode.Include
    private I id;
    private V version;

    @Override
    public I getId() {
        return this.id;
    }

    @Override
    public boolean isNew() {
        return this.id == null;
    }

    @Override
    public void setId(I id) {
        this.id = id;
    }

    @Override
    public V getVersion() {
       return this.version;
    }

    @Override
    public void setVersion(V version) {
       this.version = version;
    }


}
